﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->    

<UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
  x:Class="System.Windows.Controls.Samples.DockPanelSample">
    <StackPanel>
        <StackPanel.Resources>
            <SolidColorBrush x:Key="FirstColor" Color="#486974" />
            <SolidColorBrush x:Key="SecondColor" Color="#368BA7" />
            <SolidColorBrush x:Key="ThirdColor" Color="#30DAA7" />
            <SolidColorBrush x:Key="FourthColor" Color="#DF7169" />
            <SolidColorBrush x:Key="FifthColor" Color="#A73654" />
            <Style x:Key="DemoPanel" TargetType="Panel">
                <Setter Property="Background">
                    <Setter.Value>
                        <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                            <GradientStop Offset="0" Color="#FFC0C0C0" />
                            <GradientStop Offset=".5" Color="#FFF0F0F0" />
                            <GradientStop Offset="1" Color="#FFC0C0C0" />
                        </LinearGradientBrush>
                    </Setter.Value>
                </Setter>
                <Setter Property="Margin" Value="2" />
            </Style>
            <Style x:Key="DemoContent" TargetType="dataInput:Label">
                <Setter Property="Content" Value="Content" />
                <Setter Property="HorizontalAlignment" Value="Center" />
                <Setter Property="VerticalAlignment" Value="Center" />
                <Setter Property="HorizontalContentAlignment" Value="Center" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="Background" Value="{StaticResource FirstColor}" />
                <Setter Property="FontFamily" Value="Verdana" />
                <Setter Property="FontSize" Value="10" />
                <Setter Property="Foreground" Value="#FFFFFFFF" />
                <Setter Property="Padding" Value="1" />
                <Setter Property="Margin" Value="0 0 1 1" />
                <Setter Property="MinWidth" Value="10" />
            </Style>
        </StackPanel.Resources>

        <!-- Dock table -->
        <ContentControl Content="Dock" Style="{StaticResource Header}" />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="200" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Left" FontWeight="Bold" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="0" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" />
            </controlsToolkit:DockPanel>

            <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="Top" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="1" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" />
            </controlsToolkit:DockPanel>

            <TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="Right" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="2" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" />
            </controlsToolkit:DockPanel>

            <TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Bottom" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="3" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" />
            </controlsToolkit:DockPanel>
        </Grid>

        <!-- LastChildFill table -->
        <ContentControl Content="LastChildFill" Style="{StaticResource Header}" />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="200" />
                <RowDefinition Height="200" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="True" FontWeight="Bold" />
            <controlsToolkit:DockPanel Grid.Row="0" Grid.Column="1" Style="{StaticResource DemoPanel}" LastChildFill="True">
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="First" controlsToolkit:DockPanel.Dock="Left" />
            </controlsToolkit:DockPanel>
            <controlsToolkit:DockPanel Grid.Row="0" Grid.Column="2" Style="{StaticResource DemoPanel}" LastChildFill="True">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" />
            </controlsToolkit:DockPanel>
            <controlsToolkit:DockPanel Grid.Row="0" Grid.Column="3" Style="{StaticResource DemoPanel}" LastChildFill="True">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right" />
            </controlsToolkit:DockPanel>
            <controlsToolkit:DockPanel Grid.Row="0" Grid.Column="4" Style="{StaticResource DemoPanel}" LastChildFill="True">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Third" Background="{StaticResource ThirdColor}" controlsToolkit:DockPanel.Dock="Top" />
            </controlsToolkit:DockPanel>

            <TextBlock Grid.Row="1" Grid.Column="0" Style="{StaticResource Description}" Text="False" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="1" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" />
            </controlsToolkit:DockPanel>
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="2" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" />
            </controlsToolkit:DockPanel>
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="3" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right"/>
            </controlsToolkit:DockPanel>
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="4" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Content="Third" Background="{StaticResource ThirdColor}" controlsToolkit:DockPanel.Dock="Top" />
            </controlsToolkit:DockPanel>
        </Grid>

        <!-- Nesting and Clipping -->
        <ContentControl Content="Nesting and Clipping" Style="{StaticResource Header}" />
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="200" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="200" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Basic Spiral" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="0" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="1" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="2" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="3" Background="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="4" Background="{StaticResource FourthColor}" />
            </controlsToolkit:DockPanel>

            <TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="Full Spiral" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="1" Style="{StaticResource DemoPanel}">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="1" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="2" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="3" Background="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="4" Background="{StaticResource FourthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="5" Background="{StaticResource FifthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="6" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="7" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="8" Background="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="9" Background="{StaticResource FourthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="10" Background="{StaticResource FifthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="11" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="12" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="13" Background="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="14" Background="{StaticResource FourthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="15" Background ="{StaticResource FifthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="16" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="17" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="18" Background="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="19" Background ="{StaticResource FourthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="20" Background="{StaticResource FifthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="21" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="22" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="23" Background ="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="24" Background="{StaticResource FourthColor}" />
            </controlsToolkit:DockPanel>

            <TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="Clipping the Fifth" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="2" Style="{StaticResource DemoPanel}">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Left" Content="First" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Right" Content="Third" Background="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="90" controlsToolkit:DockPanel.Dock="Top" Content="Second" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="90" controlsToolkit:DockPanel.Dock="Bottom" Content="Fourth" Background="{StaticResource FourthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="Fifth" FontSize="20" Background="{StaticResource FifthColor}" />
            </controlsToolkit:DockPanel>

            <TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Too full for the Fifth" />
            <controlsToolkit:DockPanel Grid.Row="1" Grid.Column="3" Style="{StaticResource DemoPanel}">
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Left" Content="First" Background="{StaticResource FirstColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Right" Content="Third" Background="{StaticResource ThirdColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="100" controlsToolkit:DockPanel.Dock="Top" Content="Second" Background="{StaticResource SecondColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="100" controlsToolkit:DockPanel.Dock="Bottom" Content="Fourth" Background="{StaticResource FourthColor}" />
                <dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="Fifth" Background="{StaticResource FifthColor}" />
            </controlsToolkit:DockPanel>
        </Grid>

        <!-- Usage -->
        <ContentControl Content="Usage" Style="{StaticResource Header}" />
        <Border BorderBrush="#FF000000" BorderThickness="1" Width="400" Height="400" Margin="2" HorizontalAlignment="Left">
            <controlsToolkit:DockPanel Grid.Row="3" Grid.Column="0" Style="{StaticResource DemoPanel}" LastChildFill="False">
                <controlsToolkit:DockPanel.Background>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
                        <GradientStop Offset="0" Color="#FFE0E0E0" />
                        <GradientStop Offset=".6" Color="#FFFFFFFF" />
                        <GradientStop Offset="1" Color="#FFD0D0D0" />
                    </LinearGradientBrush>
                </controlsToolkit:DockPanel.Background>
                <StackPanel Orientation="Horizontal" Background="#FF999999" controlsToolkit:DockPanel.Dock="Top">
                    <StackPanel.Resources>
                        <Style x:Key="MenuButton" TargetType="Button">
                            <Setter Property="Height" Value="20" />
                            <Setter Property="Margin" Value="5 2 5 2" />
                            <Setter Property="Padding" Value="2 0 2 0" />
                            <Setter Property="Foreground" Value="#FFFFFFFF" />
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="Button">
                                        <Grid>
                                            <vsm:VisualStateManager.VisualStateGroups>
                                                <vsm:VisualStateGroup x:Name="CommonStates">
                                                    <vsm:VisualStateGroup.Transitions>
                                                        <vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" />
                                                    </vsm:VisualStateGroup.Transitions>
                                                    <vsm:VisualState x:Name="Normal" />
                                                    <vsm:VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <DoubleAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                                            <DoubleAnimation Storyboard.TargetName="BorderBackgroundBrush" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
                                                        </Storyboard>
                                                    </vsm:VisualState>
                                                </vsm:VisualStateGroup>
                                            </vsm:VisualStateManager.VisualStateGroups>
                                            <Border BorderThickness="1">
                                                <Border.BorderBrush>
                                                    <SolidColorBrush x:Name="BorderBrush" Opacity="0" Color="#FFCCCCCC" />
                                                </Border.BorderBrush>
                                                <Border.Background>
                                                    <SolidColorBrush x:Name="BorderBackgroundBrush" Opacity="0" Color="#FF666666" />
                                                </Border.Background>
                                                <ContentPresenter
                                                  Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}" />
                                            </Border>
                                        </Grid>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                        </Style>
                    </StackPanel.Resources>
                    <Button Content="File" Style="{StaticResource MenuButton}" />
                    <Button Content="Help" Style="{StaticResource MenuButton}" />
                </StackPanel>
                <StackPanel Orientation="Horizontal" Background="#FFAAAAAA" controlsToolkit:DockPanel.Dock="Top">
                    <StackPanel.Resources>
                        <Style x:Key="ToolbarButton" TargetType="ToggleButton">
                            <Setter Property="Width" Value="20" />
                            <Setter Property="Height" Value="20" />
                            <Setter Property="Margin" Value="10 2 5 2" />
                            <Setter Property="Padding" Value="2 0 2 0" />
                        </Style>
                    </StackPanel.Resources>
                    <ToggleButton x:Name="btnBold" Content="B" FontWeight="Bold" Style="{StaticResource ToolbarButton}" />
                    <ToggleButton x:Name="btnItalic" Content="I" FontStyle="Italic" Style="{StaticResource ToolbarButton}" />
                    <ToggleButton x:Name="btnUnderline" Content="U" Style="{StaticResource ToolbarButton}" />
                </StackPanel>
                <Line Stroke="#FF888888" StrokeThickness="1" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" />
                <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch">
                    <TextBlock x:Name="UsageText" TextWrapping="Wrap" Margin="2" HorizontalAlignment="Stretch" Text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."  />
                </ScrollViewer>
            </controlsToolkit:DockPanel>
        </Border>
        <src:SourceViewer xmlns:src="clr-namespace:System.Windows.Controls.Samples;assembly=System.Windows.Controls.Samples.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <src:SourceFile Path="DockPanelSample.xaml">
    <src:SourceFile.Source>
      <sys:String>&lt;!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
--&gt;    

&lt;UserControl
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
  xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
  xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input"
  xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
  x:Class="System.Windows.Controls.Samples.DockPanelSample"&gt;
    &lt;StackPanel&gt;
        &lt;StackPanel.Resources&gt;
            &lt;SolidColorBrush x:Key="FirstColor" Color="#486974" /&gt;
            &lt;SolidColorBrush x:Key="SecondColor" Color="#368BA7" /&gt;
            &lt;SolidColorBrush x:Key="ThirdColor" Color="#30DAA7" /&gt;
            &lt;SolidColorBrush x:Key="FourthColor" Color="#DF7169" /&gt;
            &lt;SolidColorBrush x:Key="FifthColor" Color="#A73654" /&gt;
            &lt;Style x:Key="DemoPanel" TargetType="Panel"&gt;
                &lt;Setter Property="Background"&gt;
                    &lt;Setter.Value&gt;
                        &lt;LinearGradientBrush StartPoint="0,0" EndPoint="1,1"&gt;
                            &lt;GradientStop Offset="0" Color="#FFC0C0C0" /&gt;
                            &lt;GradientStop Offset=".5" Color="#FFF0F0F0" /&gt;
                            &lt;GradientStop Offset="1" Color="#FFC0C0C0" /&gt;
                        &lt;/LinearGradientBrush&gt;
                    &lt;/Setter.Value&gt;
                &lt;/Setter&gt;
                &lt;Setter Property="Margin" Value="2" /&gt;
            &lt;/Style&gt;
            &lt;Style x:Key="DemoContent" TargetType="dataInput:Label"&gt;
                &lt;Setter Property="Content" Value="Content" /&gt;
                &lt;Setter Property="HorizontalAlignment" Value="Center" /&gt;
                &lt;Setter Property="VerticalAlignment" Value="Center" /&gt;
                &lt;Setter Property="HorizontalContentAlignment" Value="Center" /&gt;
                &lt;Setter Property="VerticalContentAlignment" Value="Center" /&gt;
                &lt;Setter Property="Background" Value="{StaticResource FirstColor}" /&gt;
                &lt;Setter Property="FontFamily" Value="Verdana" /&gt;
                &lt;Setter Property="FontSize" Value="10" /&gt;
                &lt;Setter Property="Foreground" Value="#FFFFFFFF" /&gt;
                &lt;Setter Property="Padding" Value="1" /&gt;
                &lt;Setter Property="Margin" Value="0 0 1 1" /&gt;
                &lt;Setter Property="MinWidth" Value="10" /&gt;
            &lt;/Style&gt;
        &lt;/StackPanel.Resources&gt;

        &lt;!-- Dock table --&gt;
        &lt;ContentControl Content="Dock" Style="{StaticResource Header}" /&gt;
        &lt;Grid&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition Height="Auto" /&gt;
                &lt;RowDefinition Height="200" /&gt;
            &lt;/Grid.RowDefinitions&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Left" FontWeight="Bold" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="0" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="Top" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="1" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="Right" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="2" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Bottom" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="3" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
        &lt;/Grid&gt;

        &lt;!-- LastChildFill table --&gt;
        &lt;ContentControl Content="LastChildFill" Style="{StaticResource Header}" /&gt;
        &lt;Grid&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition Height="200" /&gt;
                &lt;RowDefinition Height="200" /&gt;
            &lt;/Grid.RowDefinitions&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="Auto" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="True" FontWeight="Bold" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="0" Grid.Column="1" Style="{StaticResource DemoPanel}" LastChildFill="True"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="First" controlsToolkit:DockPanel.Dock="Left" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="0" Grid.Column="2" Style="{StaticResource DemoPanel}" LastChildFill="True"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="0" Grid.Column="3" Style="{StaticResource DemoPanel}" LastChildFill="True"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="0" Grid.Column="4" Style="{StaticResource DemoPanel}" LastChildFill="True"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="Third" Background="{StaticResource ThirdColor}" controlsToolkit:DockPanel.Dock="Top" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;

            &lt;TextBlock Grid.Row="1" Grid.Column="0" Style="{StaticResource Description}" Text="False" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="1" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="2" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="3" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right"/&gt;
            &lt;/controlsToolkit:DockPanel&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="4" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="First" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Content="Second" Background="{StaticResource SecondColor}" controlsToolkit:DockPanel.Dock="Right" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Content="Third" Background="{StaticResource ThirdColor}" controlsToolkit:DockPanel.Dock="Top" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
        &lt;/Grid&gt;

        &lt;!-- Nesting and Clipping --&gt;
        &lt;ContentControl Content="Nesting and Clipping" Style="{StaticResource Header}" /&gt;
        &lt;Grid&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition Height="Auto" /&gt;
                &lt;RowDefinition Height="200" /&gt;
            &lt;/Grid.RowDefinitions&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
                &lt;ColumnDefinition Width="200" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource Description}" Text="Basic Spiral" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="0" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="1" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="2" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="3" Background="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="4" Background="{StaticResource FourthColor}" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="1" Style="{StaticResource Description}" Text="Full Spiral" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="1" Style="{StaticResource DemoPanel}"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="1" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="2" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="3" Background="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="4" Background="{StaticResource FourthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="5" Background="{StaticResource FifthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="6" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="7" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="8" Background="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="9" Background="{StaticResource FourthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="10" Background="{StaticResource FifthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="11" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="12" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="13" Background="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="14" Background="{StaticResource FourthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="15" Background ="{StaticResource FifthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="16" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="17" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="18" Background="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="19" Background ="{StaticResource FourthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="20" Background="{StaticResource FifthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="21" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" Content="22" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Right" Content="23" Background ="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Bottom" Content="24" Background="{StaticResource FourthColor}" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="2" Style="{StaticResource Description}" Text="Clipping the Fifth" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="2" Style="{StaticResource DemoPanel}"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Left" Content="First" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Right" Content="Third" Background="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="90" controlsToolkit:DockPanel.Dock="Top" Content="Second" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="90" controlsToolkit:DockPanel.Dock="Bottom" Content="Fourth" Background="{StaticResource FourthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="Fifth" FontSize="20" Background="{StaticResource FifthColor}" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;

            &lt;TextBlock Grid.Row="0" Grid.Column="3" Style="{StaticResource Description}" Text="Too full for the Fifth" /&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="1" Grid.Column="3" Style="{StaticResource DemoPanel}"&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Left" Content="First" Background="{StaticResource FirstColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" Width="60" controlsToolkit:DockPanel.Dock="Right" Content="Third" Background="{StaticResource ThirdColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="100" controlsToolkit:DockPanel.Dock="Top" Content="Second" Background="{StaticResource SecondColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" HorizontalAlignment="Stretch" Height="100" controlsToolkit:DockPanel.Dock="Bottom" Content="Fourth" Background="{StaticResource FourthColor}" /&gt;
                &lt;dataInput:Label Style="{StaticResource DemoContent}" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Left" Content="Fifth" Background="{StaticResource FifthColor}" /&gt;
            &lt;/controlsToolkit:DockPanel&gt;
        &lt;/Grid&gt;

        &lt;!-- Usage --&gt;
        &lt;ContentControl Content="Usage" Style="{StaticResource Header}" /&gt;
        &lt;Border BorderBrush="#FF000000" BorderThickness="1" Width="400" Height="400" Margin="2" HorizontalAlignment="Left"&gt;
            &lt;controlsToolkit:DockPanel Grid.Row="3" Grid.Column="0" Style="{StaticResource DemoPanel}" LastChildFill="False"&gt;
                &lt;controlsToolkit:DockPanel.Background&gt;
                    &lt;LinearGradientBrush StartPoint="0,0" EndPoint="1,1"&gt;
                        &lt;GradientStop Offset="0" Color="#FFE0E0E0" /&gt;
                        &lt;GradientStop Offset=".6" Color="#FFFFFFFF" /&gt;
                        &lt;GradientStop Offset="1" Color="#FFD0D0D0" /&gt;
                    &lt;/LinearGradientBrush&gt;
                &lt;/controlsToolkit:DockPanel.Background&gt;
                &lt;StackPanel Orientation="Horizontal" Background="#FF999999" controlsToolkit:DockPanel.Dock="Top"&gt;
                    &lt;StackPanel.Resources&gt;
                        &lt;Style x:Key="MenuButton" TargetType="Button"&gt;
                            &lt;Setter Property="Height" Value="20" /&gt;
                            &lt;Setter Property="Margin" Value="5 2 5 2" /&gt;
                            &lt;Setter Property="Padding" Value="2 0 2 0" /&gt;
                            &lt;Setter Property="Foreground" Value="#FFFFFFFF" /&gt;
                            &lt;Setter Property="Template"&gt;
                                &lt;Setter.Value&gt;
                                    &lt;ControlTemplate TargetType="Button"&gt;
                                        &lt;Grid&gt;
                                            &lt;vsm:VisualStateManager.VisualStateGroups&gt;
                                                &lt;vsm:VisualStateGroup x:Name="CommonStates"&gt;
                                                    &lt;vsm:VisualStateGroup.Transitions&gt;
                                                        &lt;vsm:VisualTransition To="MouseOver" GeneratedDuration="0:0:0.1" /&gt;
                                                    &lt;/vsm:VisualStateGroup.Transitions&gt;
                                                    &lt;vsm:VisualState x:Name="Normal" /&gt;
                                                    &lt;vsm:VisualState x:Name="MouseOver"&gt;
                                                        &lt;Storyboard&gt;
                                                            &lt;DoubleAnimation Storyboard.TargetName="BorderBrush" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /&gt;
                                                            &lt;DoubleAnimation Storyboard.TargetName="BorderBackgroundBrush" Storyboard.TargetProperty="Opacity" To="1" Duration="0" /&gt;
                                                        &lt;/Storyboard&gt;
                                                    &lt;/vsm:VisualState&gt;
                                                &lt;/vsm:VisualStateGroup&gt;
                                            &lt;/vsm:VisualStateManager.VisualStateGroups&gt;
                                            &lt;Border BorderThickness="1"&gt;
                                                &lt;Border.BorderBrush&gt;
                                                    &lt;SolidColorBrush x:Name="BorderBrush" Opacity="0" Color="#FFCCCCCC" /&gt;
                                                &lt;/Border.BorderBrush&gt;
                                                &lt;Border.Background&gt;
                                                    &lt;SolidColorBrush x:Name="BorderBackgroundBrush" Opacity="0" Color="#FF666666" /&gt;
                                                &lt;/Border.Background&gt;
                                                &lt;ContentPresenter
                                                  Content="{TemplateBinding Content}"
                                                  ContentTemplate="{TemplateBinding ContentTemplate}" /&gt;
                                            &lt;/Border&gt;
                                        &lt;/Grid&gt;
                                    &lt;/ControlTemplate&gt;
                                &lt;/Setter.Value&gt;
                            &lt;/Setter&gt;
                        &lt;/Style&gt;
                    &lt;/StackPanel.Resources&gt;
                    &lt;Button Content="File" Style="{StaticResource MenuButton}" /&gt;
                    &lt;Button Content="Help" Style="{StaticResource MenuButton}" /&gt;
                &lt;/StackPanel&gt;
                &lt;StackPanel Orientation="Horizontal" Background="#FFAAAAAA" controlsToolkit:DockPanel.Dock="Top"&gt;
                    &lt;StackPanel.Resources&gt;
                        &lt;Style x:Key="ToolbarButton" TargetType="ToggleButton"&gt;
                            &lt;Setter Property="Width" Value="20" /&gt;
                            &lt;Setter Property="Height" Value="20" /&gt;
                            &lt;Setter Property="Margin" Value="10 2 5 2" /&gt;
                            &lt;Setter Property="Padding" Value="2 0 2 0" /&gt;
                        &lt;/Style&gt;
                    &lt;/StackPanel.Resources&gt;
                    &lt;ToggleButton x:Name="btnBold" Content="B" FontWeight="Bold" Style="{StaticResource ToolbarButton}" /&gt;
                    &lt;ToggleButton x:Name="btnItalic" Content="I" FontStyle="Italic" Style="{StaticResource ToolbarButton}" /&gt;
                    &lt;ToggleButton x:Name="btnUnderline" Content="U" Style="{StaticResource ToolbarButton}" /&gt;
                &lt;/StackPanel&gt;
                &lt;Line Stroke="#FF888888" StrokeThickness="1" HorizontalAlignment="Stretch" controlsToolkit:DockPanel.Dock="Top" /&gt;
                &lt;ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalAlignment="Stretch"&gt;
                    &lt;TextBlock x:Name="UsageText" TextWrapping="Wrap" Margin="2" HorizontalAlignment="Stretch" Text="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."  /&gt;
                &lt;/ScrollViewer&gt;
            &lt;/controlsToolkit:DockPanel&gt;
        &lt;/Border&gt;
    &lt;/StackPanel&gt;
&lt;/UserControl&gt;</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="DockPanelSample.xaml.cs">
    <src:SourceFile.Source>
      <sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System;
using System.Windows;
using System.Windows.Controls;
using System.ComponentModel;

namespace System.Windows.Controls.Samples
{
    /// &lt;summary&gt;
    /// Sample page demonstrating the DockPanel.
    /// &lt;/summary&gt;
    [Sample("DockPanel", DifficultyLevel.Basic)]
    [Category("DockPanel")]
    public partial class DockPanelSample : UserControl
    {
        /// &lt;summary&gt;
        /// Initializes a new instance of the DockPanelSample class.
        /// &lt;/summary&gt;
        public DockPanelSample()
        {
            InitializeComponent();

            // Update the toolbar demo when a button is toggled
            btnBold.Checked += (s, e) =&gt; UpdateToolbarDemo();
            btnBold.Unchecked += (s, e) =&gt; UpdateToolbarDemo();
            btnItalic.Checked += (s, e) =&gt; UpdateToolbarDemo();
            btnItalic.Unchecked += (s, e) =&gt; UpdateToolbarDemo();
            btnUnderline.Checked += (s, e) =&gt; UpdateToolbarDemo();
            btnUnderline.Unchecked += (s, e) =&gt; UpdateToolbarDemo();
        }

        /// &lt;summary&gt;
        /// Update the toolbar demo when a font property changes.
        /// &lt;/summary&gt;
        private void UpdateToolbarDemo()
        {
            UsageText.FontWeight = (btnBold.IsChecked == true) ?
                FontWeights.Bold :
                FontWeights.Normal;
            UsageText.FontStyle = (btnItalic.IsChecked == true) ?
                FontStyles.Italic :
                FontStyles.Normal;
            UsageText.TextDecorations = (btnUnderline.IsChecked == true) ?
                TextDecorations.Underline :
                null;
        }
    }
}</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="DockPanelSample.xaml.vb">
    <src:SourceFile.Source>
      <sys:String>' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.

Imports Microsoft.VisualBasic
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.ComponentModel

''' &lt;summary&gt;
''' Sample page demonstrating the DockPanel.
''' &lt;/summary&gt;
&lt;Sample("DockPanel", DifficultyLevel.Basic), Category("DockPanel")&gt; _
Partial Public Class DockPanelSample
    Inherits UserControl
    ''' &lt;summary&gt;
    ''' Initializes a new instance of the DockPanelSample class.
    ''' &lt;/summary&gt;
    Public Sub New()
        InitializeComponent()
    End Sub

    ''' &lt;summary&gt;
    ''' Update the toolbar demo when a font property changes.
    ''' &lt;/summary&gt;
    Private Sub UpdateToolbarDemo(ByVal sender As Object, ByVal e As EventArgs) _
        Handles btnBold.Checked, btnBold.Unchecked, btnItalic.Checked, btnItalic.Unchecked, _
        btnUnderline.Checked, btnUnderline.Unchecked

        UsageText.FontWeight = If((btnBold.IsChecked = True), _
                                  FontWeights.Bold, FontWeights.Normal)
        UsageText.FontStyle = If((btnItalic.IsChecked = True), _
                                 FontStyles.Italic, FontStyles.Normal)
        UsageText.TextDecorations = If((btnUnderline.IsChecked = True), _
                                       TextDecorations.Underline, Nothing)
    End Sub
End Class</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
</src:SourceViewer>
    </StackPanel>
</UserControl>